{% extends 'core/base.html' %}

{% block title %}
  {{ title }}
{% endblock %}

{% block content %}
  <div class="w-1/2 my-6 mx-auto p-6 bg-gray-100 border border-gray-300 rounded-xl">
    <h1 class="text-2xl text-center">Новый рецепт</h1>
  </div>

  <div class="w-1/2 my-6 mx-auto p-6 bg-gray-100 border border-gray-300 rounded-xl">
    <form method="post" enctype="multipart/form-data">
      {% csrf_token %}

      <div class="space-y-2">{{ form.as_p }}</div>

      {% if form.errors or form.non_field_errors %}
        <div class="mb-3 p-6 bg-red-100 rounded-xl">
          {% for field in form %}
            {{ field.errors }}
          {% endfor %}

          {{ form.non_field_errors }}
        </div>
      {% endif %}
      <div class="pt-6">
        <button class="px-3 py-2 text-lg font-semibold bg-green-700 text-white rounded-xl">Опубликовать</button>
      </div>
    </form>
  </div>
{% endblock %}
